<template>
   <el-footer id="footer">欢迎回来,当前时间：{{ date }} {{ time }}</el-footer>
</template>
<script>
export default {
     data() {
          return {
               time: '',
               date: '',
          };
     },
     mounted() {
          setInterval(this.getDateAndTime, 1000);
     },
     methods: {
          getDateAndTime: function () {
               var date = new Date();
               var year = date.getFullYear(); //当前年份
               var month = date.getMonth(); //当前月份
               var day = date.getDate(); //天
               var hours = date.getHours(); //小时
               var minute = date.getMinutes(); //分
               var second = date.getSeconds(); //秒
               let num = 0;
               hours = hours >= 10 ? num = hours : num = "0" + hours;
               minute = minute >= 10 ? num = minute : num = "0" + minute;
               second = second >= 10 ? num = second : num = "0" + second;
               this.date = year + '/' + (month + 1) + '/' + day;
               this.time = hours + ":" + minute + ":" + second;
          },
     },
}
</script>
<style>
    #footer{
        position: fixed;
        bottom: 0;
        /*left: 45%;*/
        right: 35%;
        padding-top: 8px;
        height: 24px !important;
        line-height: 0;
       font-size: 14px;
    }
</style>
